package org.dreamfly.core.dao.impl;

import org.dreamfly.core.bean.SzAuthorities;
import org.dreamfly.core.dao.AuthorityDAO;
import org.hibernate.Query;
import org.hibernate.Transaction;

/**
 * Created by IntelliJ IDEA.
 * User: gin
 * Date: 8/23/11
 * Time: 5:17 PM
 * To change this template use File | Settings | File Templates.
 */
public class AuthorityDAOImpl extends BaseDAOImpl<SzAuthorities, Long> implements AuthorityDAO {
    @Override
    public void deleteByUser(Long userId) {
        Transaction tran = this.getSession().beginTransaction();
        String hql = "Delete FROM SzAuthorities Where szUsers.id=?";
        Query q = this.getSession().createQuery(hql);
        q.setLong(0, userId);
        q.executeUpdate();
        tran.commit();
    }
}
